package com.juli.school.app.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.juli.school.dao.entity.TestScope;
import com.juli.school.service.bo.TestScopeBo;
import com.juli.school.service.impl.TestScopeService;
import com.juli.school.utils.core.model.CommonResp;

/**
 * 心理测试分数范围
 * @author wjp
 * @date 2017年10月5日
 *
 */
@RequestMapping("testScope")
@Controller
public class TestScopeController {

	@Resource
	private TestScopeService testScopeService;
	
	/**
	 * 添加一条心理测试分数范围
	 * 
	 * @param love
	 * @return
	 */
	@RequestMapping(value = "add", method = RequestMethod.POST)
	@ResponseBody
	public CommonResp<Boolean> add(TestScopeBo testScopeBo) {
		return testScopeService.add(testScopeBo);
	}
	
	/**
	 * 修改一条心理测试分数范围
	 * 
	 * @param love
	 * @return
	 */
	@RequestMapping("update")
	@ResponseBody
	public CommonResp<Boolean> update(TestScopeBo testScopeBo) {
		return testScopeService.update(testScopeBo);
	}
	
	/**
	 * 删除一条心理测试下的所有分数范围
	 * 
	 * @param snStamp
	 * @return
	 */
	@RequestMapping("delete")
	@ResponseBody
	public CommonResp<Boolean> delete(String snStamp) {
		return testScopeService.delete(snStamp);
	}
	
	/**  
	 * @Description： 根据编号和分数获取分数范围详情详情
	 * @author: hantao
	 * @since: 2017年10月23日 下午11:05:36  
	 */
	@RequestMapping("/detail")
	@ResponseBody
	public CommonResp<TestScope> detail(String snStamp, String num){
		return testScopeService.detail(snStamp, num);
	}
	
	/**
	 * @Description: 根据心理测试编号查询下面所有的分数详情
	 * @author gaoxiang
	 * @date 2017年9月16日 下午10:27:17
	 */
	@RequestMapping("/list")
	@ResponseBody 
	CommonResp<List<TestScopeBo>> list(String snStamp) {
		return testScopeService.listPage(snStamp);
	}
}
